<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>js创建对象</title>
		<script>
			//声明对象
			function Person() {};
			// //创建对象方式1
			p1 = new Person();
			p1.name = "刘亦菲";
			p1.age = 18;
			p1.method = function() {
				console.log("我是" + this.name);
			}
			console.log(p1);
			p1.method();


			//创建对象方式2
			p2 = {
				a: 1,//属性名、方法名可以不带引号
				"b": "hello",
				"c": [1, 1, 1, null, undefined, false, "??"],
				"f1": function() {
					console.log(this.a + "" + this.b);
				}
			}
			console.log(p2);
			p2.f1();

			
		</script>
	</head>
	<body>
	</body>
</html>
